#pragma once


class IPlayersManager;
class IRenderingManager;
class CRenderableObject;
class IMovable;

class ActionObject
{
private:
   IPlayersManager& m_playersManager;
   IRenderingManager& m_renderingManager;
   CRenderableObject* m_laserBeam;
   CRenderableObject* m_actionFigure;

   float m_beamVisibilityTime;
   float m_laserPower;
   float m_energyLevel;

   float m_timeUntilNextShot;
   float m_shootingInterval;

   UINT m_nextGate;
   UINT m_numGatesScored;

public:
   ActionObject(IPlayersManager& playersManager, 
                IRenderingManager& renderingManager,
                CRenderableObject* laserBeam, 
                CRenderableObject* actionFigure);
   ~ActionObject();

   void shoot();

   void drainEnergy(float amount);

   void update(float timeElapsed);

   IMovable& getMovable();

   bool isAlive() const {return m_energyLevel > 0;}

   UINT getNextGateNo() const {return m_nextGate;}
   void setNextGateNo(UINT no) {m_nextGate = no;}

   UINT getNumGatesScored() const {return m_numGatesScored;}
   void increaseNumGatesScored() {m_numGatesScored++;}

private:
   void updateBeamCoordinates();
};
